package com.heima.admin.controller.v1;


import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 敏感词管理
 * @author Lei
 */
@RestController
@RequestMapping("/api/v1/sensitive/")
public class SensitiveController {

    @Autowired
    private IWemediaClient iWemediaClient;

    /**
     * 敏感词管理: 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id) {
        return iWemediaClient.delete(id);
    }

    /**
     * 敏感词管理：修改敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive) {
        return iWemediaClient.update(wmSensitive);
    }

    /**
     * 敏感词管理: 查询列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public PageResponseResult list(@RequestBody SensitiveDto dto) {
        return iWemediaClient.list(dto);
    }

    /**
     * 敏感词管理: 保存敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping("/save")
    private ResponseResult save(@RequestBody WmSensitive wmSensitive) {
        return iWemediaClient.save(wmSensitive);
    }
}
